import http from "@/utils/verRequest/interface.js";
import env from "@/.env.js";

export const uniappToUpload = (file) => {
  return new Promise((resolve, reject) => {
    uni.showLoading({
      title: "上传中",
    });
    uni.uploadFile({
      url: env.uploadUrl,
      filePath: file.path,
      name: "file",
      fileType: "image",
      success: (res) => {
        uni.hideLoading();
        resolve(JSON.parse(res.data).data);
      },
      fail: () => {
        uni.hideLoading();
        uni.showModal({
          title: "上传失败,请重新上传",
          showCancel: false,
        });
        reject();
      },
    });
  });
};

export const getGameList = (data) =>
  new Promise((reslove, reject) => {
    reslove({
      code: 200,
      data: [
        {
          id: 1,
          name: "原神",
          icon: "https://stock-account.oss-cn-shenzhen.aliyuncs.com/product/upload/2023-06-09/1889f08f6b51eb8f/原神.png",
          url: "https://ys.mihoyo.com",
        },
        {
          id: 8,
          name: "崩坏·星穹铁道",
          icon: "https://stock-account.oss-cn-shenzhen.aliyuncs.com/product/upload/2023-06-09/1889ebf79b6229fb/崩坏-星穹铁道.png",
          url: "https://sr.mihoyo.com",
        },
        {
          id: 12,
          name: "绝区零",
          icon: "https://cphimg.leyoo888.com/product/upload/2024-07-04/190798c5a071c48c/头像logo.png",
          url: "https://zzz.mihoyo.com",
        },
        {
          id: 2,
          name: "王者荣耀",
          icon: "https://stock-account.oss-cn-shenzhen.aliyuncs.com/product/upload/2023-06-09/1889f07aa741f06f/王者荣耀.png",
          url: "https://pvp.qq.com",
        },
        {
          id: 6,
          name: "和平精英",
          icon: "https://stock-account.oss-cn-shenzhen.aliyuncs.com/product/upload/2023-06-09/1889f05aa4d2a6d0/和平精英.png",
          url: "https://gp.qq.com",
        },
        {
          id: 23,
          name: "诛仙世界",
          icon: "https://cphimg.leyoo888.com/product/upload/2025-04-02/195f6fbcb351ae7d/诛仙世界.png",
          url: "https://zxsj.wanmei.com/m/index.html",
        },
        {
          id: 11,
          name: "鸣潮",
          icon: "https://cphimg.leyoo888.com/product/upload/2024-05-23/18fa434935b21dbb/20240523-143235.jpg",
          url: "https://mc.kurogames.com/m/",
        },
        {
          id: 13,
          name: "无畏契约",
          icon: "https://cphimg.leyoo888.com/product/upload/2024-09-07/191cb4550c630312/20240907-145521.jpg",
          url: "https://xz.shbhh.cn/360soft/wuwei7.html",
        },
        {
          id: 14,
          name: "尘白禁区",
          icon: "https://cphimg.leyoo888.com/product/upload/2024-10-01/19246fb7bad1de84/20241001-152805.jpg",
          url: "https://www.cbjq.com/",
        },
        {
          id: 15,
          name: "逆水寒手游",
          icon: "https://cphimg.leyoo888.com/product/upload/2024-10-04/192581f0d83303a9/图片.jpg",
          url: "https://h.163.com/index.html",
        },
        {
          id: 16,
          name: "火影忍者",
          icon: "https://cphimg.leyoo888.com/product/upload/2024-10-23/192b52ed6571fd05/火影.jpg",
          url: "https://hyrz.qq.com/main.shtml",
        },
        {
          id: 17,
          name: "暗区突围",
          icon: "https://cphimg.leyoo888.com/product/upload/2024-11-05/192fb80cca3277f7/20221026130450_944886.png",
          url: "https://aqtw.qq.com/",
        },
        {
          id: 18,
          name: "三角洲行动",
          icon: "https://cphimg.leyoo888.com/dev/upload/2025-01-21/1948806feca1b374/20240613094838_753421.jpg",
          url: "https://df.qq.com/cp/a20240906fab/index-360.html",
        },
        {
          id: 19,
          name: "穿越火线：枪战王者",
          icon: "https://cphimg.leyoo888.com/dev/upload/2025-01-21/1948808113f1fd44/20220823133201_736973.png",
          url: "https://cfm.qq.com/",
        },
        {
          id: 20,
          name: "穿越火线",
          icon: "https://cphimg.leyoo888.com/dev/upload/2025-01-21/19488085e691fa2e/20220823132552_111584.png",
          url: "https://cf.qq.com/main.shtml",
        },
        {
          id: 21,
          name: "瓦罗兰特",
          icon: "https://cphimg.leyoo888.com/dev/upload/2025-01-26/194a167cf6326ab8/20221107155707_988937.png",
          url: "https://playvalorant.com/zh-tw/",
        },
        {
          id: 22,
          name: "三国杀移动版",
          icon: "https://cphimg.leyoo888.com/dev/upload/2025-01-26/194a1afe19a1cc8e/20220824104933_064627.png",
          url: "https://www.sanguosha.cn/pc/index",
        },
        {
          id: 24,
          name: "英雄联盟手游",
          icon: "https://cphimg.leyoo888.com/product/upload/2025-04-21/19657480c282e479/英雄联盟、.png",
          url: "https://lolm.qq.com/main.html",
        },
        {
          id: 25,
          name: "金铲铲之战",
          icon: "https://cphimg.leyoo888.com/dev/upload/2025-04-24/196673aeccb27081/7af40ad162d9f2d3572ca725febc9d13632763d066e2.jpg",
          url: "https://jcc.qq.com/#/index",
        },
        {
          id: 26,
          name: "光遇",
          icon: "https://cphimg.leyoo888.com/dev/upload/2025-04-24/1966740dcb829ce2/d043ad4bd11373f0820247911c5f5cfbfbedab64ae27.jpg",
          url: "https://sky.163.com/m/#index",
        },
        {
          id: 27,
          name: "暗区突围：无限",
          icon: "https://cphimg.leyoo888.com/product/upload/2025-05-09/196b4555a7c2b4ce/145948975243334.jpg",
          url: "https://aqtwwx.qq.com/",
        },
      ],
    });
  });
